************************************************************************** 
* Replication of Table 1 of Cycle Continues (2025)- Figure 1
**************************************************************************
clear
local current_path = c(pwd)
set scheme plotplain, permanently
cd "`current_path'"

* Load data
use ddrclacomparedmerged.dta"

tab democracyddrla if year<=2022
tab dd_democracy if year<=2008
tab democracyddrla if year<=2008
tab democracyddrla if year>2008 & year<=2022

xtset country_id year
xtsum democracyddrla bmr_democracy democracy_mpl polity2v_democracy democracylied brdemocracy vdem_democracy dd_democracy

label variable polity2v_democracy "Polity V Democracy "
label variable democracy_mpl "Mainwaring and Perez-Liñan's (2010) - MPL"
label variable brdemocracy "Bjoernskov-Rode Regime Data (2022)"
label variable dd_democracy "Original DD"
label variable vdem_democracy "VDEM"
label variable democracyddrla "DDRLA (2024)"
label variable bmr_democracy  "BMR (2022)"
label variable  democracylied "LIED (2023)"

****************************************************************************
* Figure 1 
****************************************************************************
preserve
xtset country_id year
collapse (sum) democracyddrla bmr_democracy democracy_mpl polity2v_democracy democracylied brdemocracy vdem_democracy dd_democracy, by(year)
label variable polity2v_democracy "Polity V (2018)"
label variable democracy_mpl "MPL (2010)"
label variable brdemocracy "Bjoernskov-Rode-DD Data(2022)"
label variable dd_democracy "Original DD"
label variable vdem_democracy "VDEM (2022)"
label variable democracyddrla "DDRLA (2024)"
label variable bmr_democracy  "BMR(2022)"
label variable  democracylied "LIED (2023)"
tw ///
  (tsline vdem_democracy if year>=2000 & year<=2020, mc(gray) xlabel(2000 2006 2012 2016 2022) lc(black) lpattern(dash) ///
  title("Latin America, 2000-2020") xtit(" ") ytit("Number of Democracies") legend(pos(5)ring(0)col(1))) (tsline democracyddrla if year>=2000 & year<=2020, lc(blue)) (tsline brdemocracy if year>=2000 & year<=2020, lc(black) lpattern(dash_dot)) (tsline polity2v_democracy if year>=2000 & year<=2018, lc(grey) lpattern(shortdash)) (tsline democracy_mpl if year>=2000 & year<=2010, lc(grey) lpattern(longdash)) (tsline bmr_democracy if year>=2000 & year<=2020, lc(grey) lpattern(dot)) (tsline dd_democracy if year>=2000 & year<=2008, lc(red) lpattern(longdash)) (tsline democracylied if year>=2000 & year<=2020, lc(grey) lpattern(dot))
*twoway (tsline vdemedi10d year) if year>=1946 & year<=2020, ytitle("Number of Countries in Latin America") xtitle("") |
restore 
****************************************************************************************************


